home *** CD-ROM | disk | FTP | other *** search
/ BBS in a Box 7 / BBS in a Box - Macintosh - Volume VII (BBS in a Box) (January 1993).iso / Files / Hyper / S-Sh / SD Gradebook.cpt / SuperDuper Gradebook 1.25 / card_16469.txt < prev    next >
Text File  |  1988-07-21  |  16KB  |  615 lines

  1. -- card: 16469 from stack: in.25
  2. -- bmap block id: 9963
  3. -- flags: 4000
  4. -- background id: 2780
  5. -- name: Grade Distributions
  6. ----- HyperTalk script -----
  7.  
  8. on getDistributions
  9.   global headcount,Apluscount,Acount,Aminuscount,Bpluscount, Bcount,Bminuscount,Cpluscount,Ccount,Cminuscount,Dpluscount, Dcount,Dminuscount,Ecount
  10.   global whichkind,whichfield
  11.  
  12.  
  13.   push card
  14.   put empty into card field "Distribution"
  15.   set the lockscreen to true
  16.   go card "first record"
  17.   get the number of this card
  18.   put it into start
  19.   get the number of last card
  20.   put it into finish
  21.   initCounters
  22.   repeat with count = start to finish
  23.     go card count
  24.     if field "withdrew" is empty then
  25.       get DataFor(whichfield)
  26.       put headcount+1 into headcount
  27.       play harpsichord  b
  28.     end if
  29.   end repeat
  30.   pop card
  31.   set the lockscreen to false
  32.   showDistributions
  33. end getDistributions
  34.  
  35.  
  36. on initCounters
  37.   global headcount,Apluscount,Acount,Aminuscount,Bpluscount, Bcount,Bminuscount,Cpluscount,Ccount,Cminuscount,Dpluscount, Dcount,Dminuscount,Ecount
  38.   put 0 into headcount
  39.   put 0 into Apluscount
  40.   put 0 into Acount
  41.   put 0 into Aminuscount
  42.   put 0 into Bpluscount
  43.   put 0 into Bcount
  44.   put 0 into Bminuscount
  45.   put 0 into Cpluscount
  46.   put 0 into Ccount
  47.   put 0 into Cminuscount
  48.   put 0 into Dpluscount
  49.   put 0 into Dcount
  50.   put 0 into Dminuscount
  51.   put 0 into Ecount
  52. end initCounters
  53.  
  54. function DataFor whatfield
  55. global headcount,Apluscount,Acount,Aminuscount,Bpluscount, Bcount,Bminuscount,Cpluscount,Ccount,Cminuscount,Dpluscount, Dcount,Dminuscount,Ecount
  56.  
  57. get field whatfield
  58. if it is "A+" then
  59.   put Apluscount+1 into Apluscount
  60. else if it is "A" then
  61.   put Acount+1 into Acount
  62. else if it is "A-" then
  63.   put Aminuscount+1 into Aminuscount
  64. else if it is "B+" then
  65.   put Bpluscount+1 into Bpluscount
  66. else if it is "B" then
  67.   put Bcount+1 into Bcount
  68. else if it is "B-" then
  69.   put Bminuscount+1 into Bminuscount
  70. else if it is "C+" then
  71.   put Cpluscount+1 into Cpluscount
  72. else if it is "C" then
  73.   put Ccount+1 into Ccount
  74. else if it is "C-" then
  75.   put Cminuscount+1 into Cminuscount
  76. else if it is "D+" then
  77.   put Dpluscount+1 into Dpluscount
  78. else if it is "D" then
  79.   put Dcount+1 into Dcount
  80. else if it is "D-" then
  81.   put Dminuscount+1 into Dminuscount
  82. else if it is "E" then
  83.   put Ecount+1 into Ecount
  84. end if
  85. end DataFor
  86.  
  87. on showDistributions
  88.   global headcount,Apluscount,Acount,Aminuscount,Bpluscount, Bcount,Bminuscount,Cpluscount,Ccount,Cminuscount,Dpluscount, Dcount,Dminuscount,Ecount
  89.  
  90.   global whichKind
  91.  
  92.   put 1 into linecount
  93.   get the short name of this stack
  94.   put it into line linecount of card field "Distribution"
  95.   put linecount+1 into linecount
  96.   put "Distribution of"&&whichkind&&"Grades" into line linecount of card field "Distribution"
  97.   put linecount+1 into linecount
  98.   put "Total students:"&&headcount into line linecount of card field "Distribution"
  99.   put linecount+1 into linecount
  100.   put space into line linecount of card field "Distribution"
  101.   put linecount+1 into linecount
  102.   put (round((Apluscount/headcount)*10000)/100) into perCentage
  103.   put "A+ :"&&Apluscount&&"("&perCentage&"%)" into line linecount of card field "Distribution"
  104.   put linecount+1 into linecount
  105.   put (round((Acount/headcount)*10000)/100) into perCentage
  106.   put "A  :"&&Acount&&"("&perCentage&"%)" into line linecount of card field "Distribution"
  107.   put linecount+1 into linecount
  108.   put (round((Aminuscount/headcount)*10000)/100) into perCentage
  109.   put "A- :"&&Aminuscount&&"("&perCentage&"%)" into line linecount of card field "Distribution"
  110.   put linecount+1 into linecount
  111.   put (round((Bpluscount/headcount)*10000)/100) into perCentage
  112.   put "B+ :"&&Bpluscount&&"("&perCentage&"%)" into line linecount of card field "Distribution"
  113.   put linecount+1 into linecount
  114.   put (round((Bcount/headcount)*10000)/100 )into perCentage
  115.   put "B  :"&&Bcount&&"("&perCentage&"%)" into line linecount of card field "Distribution"
  116.   put linecount+1 into linecount
  117.   put (round((Bminuscount/headcount)*10000)/100) into perCentage
  118.   put "B- :"&&Bminuscount&&"("&perCentage&"%)" into line linecount of card field "Distribution"
  119.   put linecount+1 into linecount
  120.   put (round((Cpluscount/headcount)*10000)/100) into perCentage
  121.   put "C+ :"&&Cpluscount&&"("&perCentage&"%)" into line linecount of card field "Distribution"
  122.   put linecount+1 into linecount
  123.   put (round((Ccount/headcount)*10000)/100) into perCentage
  124.   put "C  :"&&Ccount&&"("&perCentage&"%)" into line linecount of card field "Distribution"
  125.   put linecount+1 into linecount
  126.   put (round((Cminuscount/headcount)*10000)/100) into perCentage
  127.   put "C- :"&&Cminuscount&&"("&perCentage&"%)" into line linecount of card field "Distribution"
  128.   put linecount+1 into linecount
  129.   put (round((Dpluscount/headcount)*10000)/100) into perCentage
  130.   put "D+ :"&&Dpluscount&&"("&perCentage&"%)" into line linecount of card field "Distribution"
  131.   put linecount+1 into linecount
  132.   put (round((Dcount/headcount)*10000)/100) into perCentage
  133.   put "D  :"&&Dcount&&"("&perCentage&"%)" into line linecount of card field "Distribution"
  134.   put linecount+1 into linecount
  135.   put (round(Dminuscount/headcount)*10000)/100 into perCentage
  136.   put "D- :"&&Dminuscount&&"("&perCentage&"%)" into line linecount of card field "Distribution"
  137.   put linecount+1 into linecount
  138.   put (round((Ecount/headcount)*10000)/100) into perCentage
  139.   put (round(percentage * 100))/100 into perCentage
  140.   put "E  :"&&Ecount&&"("&perCentage&"%)" into line linecount of card field "Distribution"
  141.   put linecount+1 into linecount
  142. end showDistributions
  143.  
  144. function corners
  145. put framebottom() - frameheight() into topedge
  146. put frameleft()+framewidth() into rightedge
  147. put frameleft() & "," after thecorners
  148. put topedge & "," after thecorners
  149. put rightedge & "," after thecorners
  150. put framebottom() after thecorners
  151. return thecorners
  152. end corners
  153.  
  154. function frameheight
  155. return 163
  156. end frameheight
  157.  
  158. function framewidth
  159. return 234
  160. end framewidth
  161.  
  162. function framebottom
  163. return 274
  164. end framebottom
  165.  
  166. function frameleft
  167. return 20
  168. end frameleft
  169.  
  170.  
  171. on clearScreen
  172.   get corners()
  173.   put item 1 of it & "," & item 2 of it into topleft
  174.   put item 3 of it & "," & item 4 of it into bottomright
  175.   choose select tool
  176.   drag from topleft to bottomright
  177.   domenu "clear picture"
  178. end clearScreen
  179.  
  180. on doData
  181.   put empty into card field "data"
  182.   repeat with count = 5 to 17
  183.     put word 3 of line count of card field "distribution" into holder
  184.     put holder&return after card field "data"
  185.   end repeat
  186. end doData
  187.  
  188. on closeCard
  189.   if visible of card field "helpScreen" then hide card field "helpScreen"
  190.   if visible of card field "screen" then
  191.     send mouseUp to card field "screen"
  192.   end if
  193. end closeCard
  194.  
  195.  
  196.  
  197. -- part 2 (button)
  198. -- low flags: 00
  199. -- high flags: A003
  200. -- rect: left=39 top=108 right=133 bottom=212
  201. -- title width / last selected line: 0
  202. -- icon id / first selected line: 0 / 0
  203. -- text alignment: 1
  204. -- font id: 0
  205. -- text size: 12
  206. -- style flags: 0
  207. -- line height: 16
  208. -- part name: Minor Assignment Avg.
  209. ----- HyperTalk script -----
  210. on mouseup
  211.   global whichkind,whichfield
  212.   put "Minor Assignment" into whichkind
  213.   put "av minor g"into whichfield
  214.   getDistributions
  215.   doData
  216. end mouseup
  217.  
  218.  
  219.  
  220.  
  221. -- part 1 (field)
  222. -- low flags: 01
  223. -- high flags: 0002
  224. -- rect: left=262 top=38 right=318 bottom=481
  225. -- title width / last selected line: 0
  226. -- icon id / first selected line: 0 / 0
  227. -- text alignment: 0
  228. -- font id: 4
  229. -- text size: 9
  230. -- style flags: 256
  231. -- line height: 12
  232. -- part name: Distribution
  233.  
  234.  
  235. -- part 12 (button)
  236. -- low flags: 00
  237. -- high flags: A003
  238. -- rect: left=425 top=295 right=313 bottom=477
  239. -- title width / last selected line: 0
  240. -- icon id / first selected line: 0 / 0
  241. -- text alignment: 1
  242. -- font id: 3
  243. -- text size: 9
  244. -- style flags: 256
  245. -- line height: 12
  246. -- part name: help
  247. ----- HyperTalk script -----
  248. on mouseUp
  249.   show card field "helpScreen"
  250. end mouseUp
  251.  
  252.  
  253.  
  254. -- part 3 (button)
  255. -- low flags: 00
  256. -- high flags: A003
  257. -- rect: left=40 top=143 right=168 bottom=214
  258. -- title width / last selected line: 0
  259. -- icon id / first selected line: 0 / 0
  260. -- text alignment: 1
  261. -- font id: 0
  262. -- text size: 12
  263. -- style flags: 0
  264. -- line height: 16
  265. -- part name: Exam Avg.
  266. ----- HyperTalk script -----
  267. on mouseup
  268.   global whichkind,whichfield
  269.   put "Exam" into whichkind
  270.   put "av exam g"into whichfield
  271.   getDistributions
  272.   doData
  273. end mouseup
  274.  
  275.  
  276. -- part 4 (button)
  277. -- low flags: 00
  278. -- high flags: A003
  279. -- rect: left=39 top=178 right=203 bottom=215
  280. -- title width / last selected line: 0
  281. -- icon id / first selected line: 0 / 0
  282. -- text alignment: 1
  283. -- font id: 0
  284. -- text size: 12
  285. -- style flags: 0
  286. -- line height: 16
  287. -- part name: Paper Avg.
  288. ----- HyperTalk script -----
  289. on mouseup
  290.   global whichkind,whichfield
  291.   put "Paper" into whichkind
  292.   put "av paper g"into whichfield
  293.   getDistributions
  294.   doData
  295. end mouseup
  296.  
  297.  
  298. -- part 5 (button)
  299. -- low flags: 00
  300. -- high flags: A003
  301. -- rect: left=38 top=212 right=239 bottom=216
  302. -- title width / last selected line: 0
  303. -- icon id / first selected line: 0 / 0
  304. -- text alignment: 1
  305. -- font id: 0
  306. -- text size: 12
  307. -- style flags: 0
  308. -- line height: 16
  309. -- part name: Final Exam
  310. ----- HyperTalk script -----
  311. on mouseup
  312.   global whichkind,whichfield
  313.   put "Final" into whichkind
  314.   put "Final Exam Grade"into whichfield
  315.   getDistributions
  316.   doData
  317. end mouseup
  318.  
  319.  
  320. -- part 6 (button)
  321. -- low flags: 00
  322. -- high flags: A003
  323. -- rect: left=39 top=251 right=277 bottom=216
  324. -- title width / last selected line: 0
  325. -- icon id / first selected line: 0 / 0
  326. -- text alignment: 1
  327. -- font id: 0
  328. -- text size: 12
  329. -- style flags: 0
  330. -- line height: 16
  331. -- part name: TERM
  332. ----- HyperTalk script -----
  333. on mouseup
  334.   global whichkind,whichfield
  335.   put "Term" into whichkind
  336.   put "Term Grade"into whichfield
  337.   getDistributions
  338.   doData
  339. end mouseup
  340.  
  341.  
  342. -- part 7 (button)
  343. -- low flags: 00
  344. -- high flags: A004
  345. -- rect: left=16 top=297 right=319 bottom=81
  346. -- title width / last selected line: 0
  347. -- icon id / first selected line: 0 / 0
  348. -- text alignment: 1
  349. -- font id: 3
  350. -- text size: 9
  351. -- style flags: 256
  352. -- line height: 12
  353. -- part name: to Records
  354. ----- HyperTalk script -----
  355. on mouseUp
  356.   visual effect dissolve
  357.   go card "first record"
  358. end mouseUp
  359.  
  360.  
  361.  
  362. -- part 9 (button)
  363. -- low flags: 00
  364. -- high flags: A004
  365. -- rect: left=85 top=298 right=319 bottom=157
  366. -- title width / last selected line: 0
  367. -- icon id / first selected line: 0 / 0
  368. -- text alignment: 1
  369. -- font id: 3
  370. -- text size: 9
  371. -- style flags: 256
  372. -- line height: 12
  373. -- part name: to Averages
  374. ----- HyperTalk script -----
  375. on mouseUp
  376.   visual effect dissolve
  377.   go card "averages"
  378. end mouseUp
  379.  
  380.  
  381.  
  382. -- part 15 (button)
  383. -- low flags: 00
  384. -- high flags: A003
  385. -- rect: left=267 top=296 right=314 bottom=319
  386. -- title width / last selected line: 0
  387. -- icon id / first selected line: 0 / 0
  388. -- text alignment: 1
  389. -- font id: 3
  390. -- text size: 9
  391. -- style flags: 256
  392. -- line height: 12
  393. -- part name: clear
  394. ----- HyperTalk script -----
  395. on mouseUp
  396.   put empty into card field "distribution"
  397. end mouseUp
  398.  
  399.  
  400.  
  401. -- part 16 (button)
  402. -- low flags: 00
  403. -- high flags: A003
  404. -- rect: left=354 top=295 right=314 bottom=396
  405. -- title width / last selected line: 0
  406. -- icon id / first selected line: 0 / 0
  407. -- text alignment: 1
  408. -- font id: 3
  409. -- text size: 9
  410. -- style flags: 256
  411. -- line height: 12
  412. -- part name: print
  413. ----- HyperTalk script -----
  414. on mouseUp
  415.   set cursor to 4
  416.   doMenu "Print Card"
  417. end mouseUp
  418.  
  419.  
  420.  
  421. -- part 11 (field)
  422. -- low flags: 81
  423. -- high flags: 2004
  424. -- rect: left=262 top=38 right=319 bottom=481
  425. -- title width / last selected line: 0
  426. -- icon id / first selected line: 0 / 0
  427. -- text alignment: 0
  428. -- font id: 3
  429. -- text size: 9
  430. -- style flags: 0
  431. -- line height: 12
  432. -- part name: helpScreen
  433. ----- HyperTalk script -----
  434. on mouseup
  435.   hide card field "helpScreen"
  436. end mouseup
  437.  
  438.  
  439. -- part 13 (field)
  440. -- low flags: 81
  441. -- high flags: 0002
  442. -- rect: left=15 top=278 right=295 bottom=259
  443. -- title width / last selected line: 0
  444. -- icon id / first selected line: 0 / 0
  445. -- text alignment: 0
  446. -- font id: 3
  447. -- text size: 12
  448. -- style flags: 0
  449. -- line height: 16
  450. -- part name: screen
  451. ----- HyperTalk script -----
  452. on mouseUp
  453.   set userlevel to 5
  454.   set the lockscreen to true
  455.   clearscreen
  456.   showButtons
  457.   hide card field "screen"
  458.   choose browse tool
  459.   set the lockscreen to false
  460.   set userlevel to 2
  461. end mouseUp
  462.  
  463. on showButtons
  464.   show card button "Minor Assignment Avg."
  465.   show card button "Exam Avg."
  466.   show card button "Paper Avg."
  467.   show card button "Final Exam"
  468.   show card button "Term"
  469. end showButtons
  470.  
  471.  
  472.  
  473. -- part 14 (field)
  474. -- low flags: 81
  475. -- high flags: 0002
  476. -- rect: left=400 top=74 right=240 bottom=440
  477. -- title width / last selected line: 0
  478. -- icon id / first selected line: 0 / 0
  479. -- text alignment: 0
  480. -- font id: 3
  481. -- text size: 9
  482. -- style flags: 256
  483. -- line height: 12
  484. -- part name: data
  485.  
  486.  
  487. -- part 17 (button)
  488. -- low flags: 00
  489. -- high flags: A004
  490. -- rect: left=162 top=298 right=319 bottom=240
  491. -- title width / last selected line: 0
  492. -- icon id / first selected line: 0 / 0
  493. -- text alignment: 1
  494. -- font id: 3
  495. -- text size: 9
  496. -- style flags: 256
  497. -- line height: 12
  498. -- part name: bar graph
  499. ----- HyperTalk script -----
  500. on mouseUp
  501.   if not visible of card field "screen" then
  502.     buildGraph
  503.   else
  504.     deleteGraph
  505.   end if
  506. end mouseUp
  507.  
  508. on buildGraph
  509.   hideButtons
  510.   show card field "screen"
  511.   put the userLevel into saveLevel
  512.   if the userLevel < 3 then set userLevel to 3 -- "Painting"
  513.   if the userLevel < 3 then exit mouseUp
  514.   clearScreen --find this handler somewhere
  515.   reset paint
  516.   choose rect tool
  517.   set lineSize to 1
  518.   set pattern to 14
  519.   set filled to true
  520.   put frameleft() into horiz
  521.   put maxLine(card field "Data") into maxValue
  522.   put the number of lines in card field "Data" into dataCount
  523.   put round(framewidth()/dataCount) into horizStep
  524.   put round(horizStep * 3/4) into width
  525.   repeat with i = 1 to dataCount
  526.     get line i of card field "data"
  527.     if it is not empty then
  528.       put round(frameheight() * it / maxValue) into height
  529.       drag from horiz,framebottom()-height to horiz+width,framebottom()
  530.     end if
  531.     add horizStep to horiz
  532.   end repeat
  533.   reset paint
  534.   choose browse tool
  535.   set userLevel to saveLevel
  536. end buildGraph
  537.  
  538. function maxLine what
  539. put 0 into result
  540. repeat with i = 1 to the number of lines in what
  541.   put max(line i of what,result) into result
  542. end repeat
  543. return result
  544. end maxLine
  545.  
  546.  
  547. on hideButtons
  548.   set the lockscreen to true
  549.   hide card button "Minor Assignment Avg."
  550.   hide card button "Exam Avg."
  551.   hide card button "Paper Avg."
  552.   hide card button "Final Exam"
  553.   hide card button "Term"
  554.   set the lockscreen to false
  555. end hideButtons
  556.  
  557. on deleteGraph
  558.   set userlevel to 5
  559.   set the lockscreen to true
  560.   clearscreen
  561.   showButtons
  562.   hide card field "screen"
  563.   choose browse tool
  564.   set the lockscreen to false
  565.   set userlevel to 2
  566. end deleteGraph
  567.  
  568. on showButtons
  569.   show card button "Minor Assignment Avg."
  570.   show card button "Exam Avg."
  571.   show card button "Paper Avg."
  572.   show card button "Final Exam"
  573.   show card button "Term"
  574. end showButtons
  575.  
  576.  
  577.  
  578.  
  579. -- part contents for card part 11
  580. ----- text -----
  581.  
  582. Clicking on one of the five major buttons will generate a display of the grade distribution for that category in the display window.
  583.  
  584. Clicking on the "clear" button clears the contents from the display window.
  585.  
  586. Clicking on the "bar graph" button will produce a bar graph of the grade distribution currently displayed.
  587.  
  588. To make the bar graph go away, click on the 
  589. "bar graph" button again.
  590.  
  591. Clicking on the "print" button sends this card to the printer.  Be sure your printer is turned on.
  592.  
  593.  
  594.       click in this window to send it away.
  595.  
  596. -- part contents for card part 13
  597. ----- text -----
  598. A+ A  A- B+ B  B- C+ C  C- D+ D  D-  E
  599.  
  600. -- part contents for card part 14
  601. ----- text -----
  602. 0
  603. 0
  604. 0
  605. 0
  606. 0
  607. 0
  608. 0
  609. 0
  610. 0
  611. 0
  612. 0
  613. 0
  614. 0
  615.